//-------------------------------inculde----------------------------------------
#include "osapi.h"
#include "user_interface.h"
#include "gpio.h"
#include "driver/gpio16.h"
#include "driver/uart.h"
//------------------------------------------------------------------------------

//-----------------------------static vars--------------------------------------
static  os_timer_t  nt_timer1;
//------------------------------------------------------------------------------

//-----------------------------static func--------------------------------------
static void _nt_timer1_callback(void)
{
  static  uint8 flag = 0;
  if(flag){
    flag = 0;
    gpio16_output_set(1);
    GPIO_OUTPUT_SET(GPIO_ID_PIN(4),  1);
    GPIO_OUTPUT_SET(GPIO_ID_PIN(14), 1);
  }else{
    flag = 1;
    gpio16_output_set(0);
    GPIO_OUTPUT_SET(GPIO_ID_PIN(4),  0);
    GPIO_OUTPUT_SET(GPIO_ID_PIN(14), 0);
  }
  uart0_sendStr("\r\nHello World\r\n");
}
//------------------------------------------------------------------------------

//-----------------------------public func--------------------------------------
void user_rf_pre_init(void)
{
}

void user_init(void)
{
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U,  FUNC_GPIO14);
  gpio16_output_conf();

  os_timer_disarm(&nt_timer1);
  os_timer_setfn(&nt_timer1, (os_timer_func_t*)_nt_timer1_callback, NULL);
  os_timer_arm(&nt_timer1, 2000, 1);  //2000ms

  uart_init(115200, 115200);
  uart0_sendStr("\r\nHello World\r\n");
}
//--------------------------------EOF-------------------------------------------




